﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using WeddingEventManagement_API;

namespace WeddingEventManagementApp.Models
{
    // ViewModel for the Client Model 
    public class Client_VM
    {
        public int ClientID { get; set; }

        [Required(ErrorMessage = "First Name is Required")]
        [Display(Prompt = "First")]
        public string FirstName { get; set; }

        [Required(ErrorMessage = "Last Name is Required")]
        [Display(Prompt = "Last")]
        public string LastName { get; set; }

        [Required(ErrorMessage = "Email is Required")]
        [Display(Prompt = "Email")]
        [EmailAddress]
        public string Email { get; set; }

        public List<ClientPhone_VM> Phones { get; set; }

        [DataType(DataType.Text)]
        public string Address { get; set; }

        public List<string> AllUniqueCities { get; set; }

        public string City { get; set; }

        public Province Province { get; set; }

        [RegularExpression("^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1} *\\d{1}[A-Z]{1}\\d{1}$", ErrorMessage="Must be a Valid Postal Code")]
        public string PostalCode { get; set; }

        [DataType(DataType.MultilineText)]
        [Display(Prompt = "Add notes here")]
        public string Notes { get; set; }
    }

    // ViewModel for ClientPhone
    public class ClientPhone_VM
    {
        public int? ID { get; set; }

        public PhoneNumberTypeEnum PhoneNumberType { get; set; }

        [Required]
        [RegularExpression("[0-9][0-9][0-9]", ErrorMessage = "Must be 3 numbers")]
        public int AreaCode { get; set; }

        [Required]
        [RegularExpression("[0-9][0-9][0-9]", ErrorMessage = "Must be 3 numbers")]
        public int Exchange { get; set; }

        [Required]
        [RegularExpression("[0-9][0-9][0-9][0-9]", ErrorMessage = "Must be 4 numbers")]
        public int LineNumber { get; set; }

        public int? Extension { get; set; }
    }

    public class ClientDetailInvoice_VM
    {
        public int ClientID { get; set; }
        public string EventName { get; set; }
        public DateTime DueDate { get; set; }
        public decimal OutstandingBalance { get; set; }
        public int InvoiceID { get; set; }
        public decimal Total { get; set; }
    }

    public class ClientMain_VM
    {
        public IEnumerable<ClientIsotope> IsotopeClients { get; set; }
        public IEnumerable<Client> RecentViewedClients { get; set; }
        public IEnumerable<Client> RecentAddedClients { get; set; }
    }

    public class AutoCompleteClient_VM
    {
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Gravatar { get; set; }
        public string FullName { get; set; }
    }

    public class ClientGrid_VM
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Email { get; set; }
        public string Link { get; set; }
        public string City { get; set; }
        public string Address { get; set; }
        public string Province { get; set; }
        public string PostalCode { get; set; }
    }
}